package com.devshephard.redis.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;

import java.util.Set;

@RestController
public class RedisController {


    @Autowired
    Jedis jedis;

    @Autowired
    RedisTemplate redisTemplate;

    @GetMapping("/redis/setKey/{key}")
    public String RedisSetKey(@PathVariable("key") String key){


        jedis.set(key,key);
        Set<String> keys = jedis.keys("*");
        return keys.toString();

    }


    @GetMapping("/redis/get/redisTemp")
    public String getRedisTemp(){

        System.out.println(redisTemplate);
        return redisTemplate.toString();

    }
}
